package jp.co.lkg.springsmp.services.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import jp.co.lkg.springsmp.common.Page;
import jp.co.lkg.springsmp.common.dao.OrderinfoDao;
import jp.co.lkg.springsmp.common.db.dto.OrderinfoDto;
import jp.co.lkg.springsmp.services.OrderinfoService;



@Component
public class OrderinfoServiceImpl implements OrderinfoService{

	@Autowired
	private OrderinfoDao orderinfoDao;
	
	@Override
	public OrderinfoDto selectByPk(OrderinfoDto dto) {
		// TODO Auto-generated method stub
		return orderinfoDao.selectByPk(dto);
	}

	@Override
	public List<OrderinfoDto> select(OrderinfoDto dto) {
		// TODO Auto-generated method stub
		return orderinfoDao.select(dto);
	}

	@Override
	public void insert(OrderinfoDto dto) {
		// TODO Auto-generated method stub
		orderinfoDao.insert(dto);
	}

	@Override
	public void updateByPk(OrderinfoDto dto) {
		// TODO Auto-generated method stub
		orderinfoDao.updateByPk(dto);
	}

	@Override
	public void deleteByPk(OrderinfoDto dto) {
		// TODO Auto-generated method stub
		orderinfoDao.deleteByPk(dto);
	}

	@Override
	public void updateIncludeNull(OrderinfoDto dto) {
		// TODO Auto-generated method stub
		orderinfoDao.updateIncludeNull(dto);
	}

	@Override
	public Page selectPage(Integer currPage, OrderinfoDto dto) {
		// TODO Auto-generated method stub
		Page page =new Page();
		if(currPage==null) currPage=1;
		page.setCurrPage(currPage);
		int Count =orderinfoDao.selectAllPage();
		page.setTotalSize(Count);
		page.initTotalPage();
		page.setMinnumber(currPage);
		page.setMaxnumber(currPage);
		dto.setMaxnumber(page.getMaxnumber());
		dto.setMinnumber(page.getMinnumber());
		page.setOrderlist(orderinfoDao.selectAllOrder(dto));
		return page;
	}

	@Override
	public List<OrderinfoDto> selectAllOrder(OrderinfoDto dto) {
		// TODO Auto-generated method stub
		return orderinfoDao.selectAllOrder(dto);
	}
	
}
